<%@ page language="java" import="java.util.*,java.net.URLDecoder" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String loginName="";
String uid="";
Cookie[] cookArr = request.getCookies();
if(cookArr!=null){
	for(Cookie c:cookArr){
		if(c.getName().equals("LOGINNAME")){
			loginName = URLDecoder.decode(c.getValue(),"UTF-8");
		}
		if(c.getName().equals("UID")){
			uid = c.getValue();
		}
		c.getValue();
	}
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<title>添加商品</title>
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
		function my(){
			var msg = '${MSG}';
			if(msg!=""){
				alert(msg);
			}
		}
		function checkAdd(){
			var shopnumber = document.getElementsByName("shopnumber")[0].value;
			var sname = document.getElementsByName("sname")[0].value;
			var price = document.getElementsByName("price")[0].value;
			var stock = document.getElementsByName("stock")[0].value;
			var sdescribe = document.getElementsByName("sdescribe")[0].value; 
			var addpicture = document.getElementsByName("addpicture")[0].value; 
			var addlongpic = document.getElementsByName("addlongpic")[0].value;
			if(shopnumber=="" || shopnumber==null){
				alert("商品编号不能为空");
				return false;
			}else if(sname=="" || sname==null){
				alert("商品名称不能为空");
				return false;
			}else if(price=="" || price==null){
				alert("商品价格不能为空");
				return false;
			}else if(stock=="" || stock==null){
				alert("商品库存不能为空");
				return false;
			}else if(sdescribe=="" || sdescribe==null){
				alert("商品描述不能为空");
				return false;
			}else if(addpicture=="" || addpicture==null){
				alert("商品图片不能为空");
				return false;
			}else if(addlongpic=="" || addlongpic==null){
				alert("商品详细图片不能为空");
				return false;
			}
			return true;
		}
	</script>
</head>
<body onclick="my()">
<div class="page-container">
<div >添加商品:</div>
	<form class="form form-horizontal" id="form-article-add" action="<%=basePath%>shop/shopAddshop.do" method="post" enctype="multipart/form-data" name="f1" onsubmit="return checkAdd()">
		<input type="hidden" name="uname" value="<%=loginName%>">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span style="color: red;">*</span>商品编号：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value=""  name="shopnumber">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span style="color: red;">*</span>商品名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value=""  name="sname">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span style="color: red;">*</span>商品价格：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value=""  name="price">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span style="color: red;">*</span>商品类别：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box">
				<select name="product_type" class="select">
					<option value="0">全部分类</option>
					<option value="面膜">面膜</option>
					<option value="护肤套装">护肤套装</option>
					<option value="眼霜">眼霜</option>
					<option value="水乳">水乳</option>
					<option value="口红">口红</option>
					<option value="精华">精华</option>
					<option value="洁面">洁面</option>
					<option value="粉底">粉底</option>
					<option value="香水">香水</option>
					<option value="眼影眼线">眼影眼线</option>
				</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">商品状态：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<select name="sstatic" class="select" >
					<option value="0" selected="selected">下架</option>
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span style="color: red;">*</span>商品库存：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" name="stock">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">上架日期：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="date" id="datemin" class="input-text Wdate" name="time">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span style="color: red;">*</span>商品描述：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text"  id="datemax" class="input-text Wdate" name="sdescribe" style="width:1095px;height:150px" >
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span style="color: red;">*</span>商品图片：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="file" class="input-text" value=""  name="addpicture">
			</div> 
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span style="color: red;">*</span>详情图片：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="file" class="input-text" value=""  name="addlongpic">
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<input type="submit" class="btn btn-primary radius" type="button" value="保存并提交审核">
				<input type="button" onClick="return_level();" class="btn btn-default radius" type="button" id="rt" value="取消">
			</div>
		</div>
	</form>
</div>


<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="../lib/jquery.validation/1.14.0/messages_zh.js"></script> 
<script type="text/javascript" src="../lib/webuploader/0.1.5/webuploader.min.js"></script> 
<script type="text/javascript">
	function return_level(){
	
		document.f1.action="<%=basePath%>shop/product_list.do?uid=<%=uid%>";
		document.f1.submit();
	}
</script>
</body>
</html>
